#ifndef _MODEL_HPP
#define _MODEL_HPP

#include "PhoenixInitializer.hpp"
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#include <vector>
#include <map>
#include "Camera.hpp"
#include "glpp/ArrayObject.hpp"
#include "glpp/Material.hpp"
#include "glpp/Texture.hpp"
#include "glpp/UniformBuffer.hpp"

namespace phx
{

class Model
{
public:
	Model();
	bool loadFromFile(const std::string &filepath);
	void render();

	bool getOutlinesVisible();
	void setOutlinesVisible(bool visible);
	void setCamera(phx::Camera &camera);

	void setPosition(const phx::vec3f &pos);
	void setScale(const phx::vec3f &scale);

	void rotate(const float degrees, const phx::vec3f &angle);
	~Model();
private:
	bool mDrawOutline;
	phx::Camera *mCamera;
	glm::mat4 mModelMatrix;
	vec3f mScale;

	std::vector<gl::ArrayObject*> mArrayObjects;
	std::vector<gl::Texture*> mTextures;
	std::vector<gl::UniformBuffer*> mMaterialBuffers;
	std::map<std::string, gl::Texture*> mTextureIdMap;

	gl::UniformBuffer mMatricesBuffer;

	phx::vec3f mMin, mMax;
};

}

#endif